<template>
	<VantNav title="咖啡券审核列表" />
	
	<div class="list">
		<van-cell class="cell" title="申请人" value="申请时间" />

		<van-swipe-cell v-for="(user, index) in userList" :key="user.id">
		  <van-cell :border="false" :title="user.name" :value="user.createTime" />
		  <template #right>
			  <van-button square type="primary" text="审核" @click="verifyHandler(index)"/>
		    <van-button square type="danger" text="删除" />
		  </template>
		</van-swipe-cell>
		
	</div>
</template>

<script>

import VantNav from '@/components/VantNav.vue'

export default {
	components: {
		VantNav, 
	},
	data() {
		return {
			show: false, 
			userList: [
				{
					id: 1,
					name: "张三",
					createTime: "2023/12/03 20:40:14",
					reason: "我想和咖啡",
				},
				{
					id: 2,
					name: "李四",
					createTime: "2023/12/03 20:40:14",
					reason: "作业完成情况良好，特申请咖啡一杯",
				}
			]
		}
	},
	methods: {
		verifyHandler(index) {
			let data = this.userList[index] ;
			this.$layer.confirm(data.reason, {title: '申请原因'}, (index)=> {
				// 关闭窗口
				this.$layer.close(index);
			})
		}
	}
}	

</script>

<style scoped>
.list {
	margin: 20px;
}

.list .cell {
	background-color: #f9f9f9;
}


</style>